package com.lg.houtai.ui;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import com.lg.houtai.manager.ActivityManager;
import com.lg.houtai.manager.TaskManager;
import com.weibo.net.Weibo;

public class BaseActivity extends Activity {
	protected int actID;
	protected ActivityManager activityManager;
	protected TaskManager taskManager;
	protected Weibo weibo;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		activityManager = ActivityManager.getInstance();
		taskManager = TaskManager.getInstance();
		weibo=Weibo.getInstance();
		actID = activityManager.getSize();
		activityManager.addActivity(this);
	}

	@Override
	protected void onDestroy() {
		super.onDestroy();
		activityManager.removeActivity(this);
	}
	
	public void clickButton(View v){
		
	}

	public void setActID(int actID) {
		this.actID = actID;
	}

	public int getActID() {
		return actID;
	}

	public void refresh(Task task) {
		
	}

	protected void toast(String msg) {
		Toast.makeText(getApplicationContext(), msg, Configs.TOAST_TIME).show();
	}
	
	protected Task getTask(int actID, int taskType,boolean isGet) {
		Task task=new Task(actID, taskType);
		task.setUrl(Urls.getUrl(taskType));
		task.setRequestMethod(isGet);
		return task;
	}

}
